<?php include "../public/header.php";?>
<?php include "../public/header_show.php";?>
<body id="xiangqingPage">
<div id="xiangqingBox">
    <div class="page-title">
        <div class="page-title-con">
            <span class="pageshowtitle">详情</span>
            <div class="page-title-opt-list">
                <?php include "../public_flow/flow_show_optbut.php";?>
                <button class="layui-btn layui-btn-sm btn-light marginr5 opt">
                    操作<i class="layui-icon layui-icon-down layui-font-12"></i>
                </button>
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
    <div class="main-container">

        <div><?php include "../public_flow/flow_show_info.php";?></div>

        <div class="table-box tablenes">
            <div class="title"><span>基本信息</span><span onclick="go_to_engin_xiang()" class="colorlan" style="float: right;margin-right: 12px">查看工程概况</span></div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">工程名称</td><td id="enginname" class="colorlan tv" ></td></tr>
                </tbody>
            </table>
        </div>

        <div class="table-box tablenes">
            <div class="title">合同信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">采购合同</td><td id="caiid_name" class="colorlan tv" ></td><td class="tt">销售方</td><td id="gonger" class="tv" ></td></tr>
                </tbody>
            </table>
        </div>

        <div class="table-box tablenes">
            <div class="title">结算信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">结算主题</td><td id="title" colspan="3" class="tv"></td></tr>
                <tr><td class="tt">结算金额(元)</td><td id="money" colspan="3" class="tv"></td></tr>
                <tr><td class="tt">结算日期</td><td class="tv" id="jiedt" colspan="3"></td></tr>
                <tr><td class="tt">备注</td><td class="tv" id="explain" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>


        <div><?php include "../public/upinfo_show.php";?></div>


        <div class="table-box tablenes">
            <script type="text/html" id="toolbarDemo_ming">
                明细信息
            </script>
            <div class="tableShow">
                <table id="datalist_ming" lay-filter="datalist_ming"></table>
            </div>
        </div>


        <div><?php include "../public_flow/flow_show_flowrelas.php";?></div>



        <div><?php include '../public_flow/flow_show_shenlog.php'?></div>
        <div><?php include '../public_flow/flow_show_talk.php'?></div>
        <div><?php include '../public/opt_browse.php'?></div>
    </div>
</div>
<script>
    var param_isdan = getQueryVariable('isdan') || 0;
    if(param_isdan > 0){
        $("#page-close").remove();
    }
    var param_id = getQueryVariable('id') || 0;
    var pub_enginid;
    layui.use(['form', 'layer', "laytp",'element','dropdown','laypage','table','soulTable'], function() {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable,element = layui.element;

        facade.ajax({url: ask_contract_cai_jie_show, data:{id: param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                var engininfo = res.data.engininfo;
                var caiinfo = res.data.caiinfo;

                if(engininfo){
                    pub_enginid = engininfo.id
                    $("#enginname").text(engininfo.name).click(function () {
                        openPage('../engin/show.php?id='+engininfo.id);
                    });
                }
                if(caiinfo){
                    $("#caiid_name").text(caiinfo.name).click(function () {
                        openPage('../contract_cai/show.php?id='+caiinfo.id);
                    });
                    $("#gonger").text(caiinfo.gonger);
                }


                $("#title").text(data.title);
                $("#jiedt").text(data.jiedt);
                $("#money").text(parseFormatNum(data.money));
                $("#explain").text(data.explain);


                var mytableList22 = table.render({
                    elem: "#datalist_ming",data:res.data.list, toolbar: '#toolbarDemo_ming', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号'}
                        ,{field: 'name', title: '名称及规格'}
                        ,{field: 'unit', title: '单位'}
                        ,{field: 'num', title: '数量'}
                        ,{field:'price',title:'单价(元)',templet: function(d){
                                return parseFormatNum(d.price);
                            }}
                        ,{field:'money',title:'金额(元)',templet: function(d){
                                return parseFormatNum(d.money);
                            }}
                        ,{field: 'explain', title: '备注'}

                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });

                public_flow_show_display(res.data.billinfo);
                public_upload_show_file('upload_files', res.data.files);
                render_from();
            }
        });

        public_get_readsandlog('contract_cai_jie', param_id);
    });







    function go_to_engin_xiang(){
        if(pub_enginid){
            openPage('../engin/xiang.php?id='+pub_enginid);

        }else{
            facade.error("暂无工程信息");return false;
        }
    }
</script>
</body>
</html>




